package com.hopes.bizz.risk.transfer.bean.dto;

import com.alibaba.fastjson.annotation.JSONField;
import com.hopes.bizz.risk.transfer.constant.RiskConstant;
import com.hopes.bizz.risk.transfer.validation.Include;
import com.hopes.bizz.risk.transfer.validation.MeasuresClassify;
import com.hopes.bizz.risk.transfer.validation.UUID;
import com.hopes.bizz.risk.transfer.validation.group.SeqOne;
import com.hopes.bizz.risk.transfer.validation.group.SeqThree;
import com.hopes.bizz.risk.transfer.validation.group.SeqTwo;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;

/**
 * @author lyb
 * @version 1.0
 * @description: 管控措施
 * @date 2024/2/1 11:00
 */

@Data
@EqualsAndHashCode(callSuper = true)
public class RiskControlMeasuresDto extends RiskBaseLogicDto {

    private static final long serialVersionUID = 7754079923947182459L;

    @NotBlank(message = "风险事件ID为空", groups = SeqOne.class)
    @UUID(message = "风险事件ID不符合UUID正则", groups = SeqTwo.class)
    private String riskEventId;
    /**
     * 管控方式 1、自动化监控 2、隐患排查 3、其他
     **/
    @Include(allowEmpty = true, item = {"1", "2", "3"}, message = "管控方式字典项不符合字典枚举,请核对文档<<管控方式>>字典", groups = SeqOne.class)
    private String dataSrc;

    @NotBlank(message = "管控措施描述为空", groups = SeqOne.class)
    private String riskMeasureDesc;

    @NotBlank(message = "隐患排查内容为空", groups = SeqOne.class)
    private String troubleshootContent;

    @NotBlank(message = "管控措施分类1为空", groups = SeqOne.class)
    @Include(item = {"1", "2", "3", "4"}, message = "管控措施分类1字典项不符合字典枚举,请核对文档<<管控措施分类1>>字典", groups = SeqTwo.class)
    private String classify1;

    @NotBlank(message = "管控措施分类2为空", groups = SeqOne.class)
    private String classify2;
    /**
     * 管控措施分类3
     **/
    private String classify3;


    @MeasuresClassify(groups = SeqThree.class)
    @JSONField(serialize = false)
    public String getMeasuresClassify() {
        return classify1 + RiskConstant.VALIDATOR_JOIN + classify2;
    }
}
